// 依赖实体类
const SafeString = require('../base/SafeString');
const SafeNumber = require('../base/SafeNumber');

// 配置类
const config = require('../../config').config;

/**
 * 实体类 UpdateWashRecord 用于接收修改的洗消记录信息
 */
class UpdateWashRecord {
    constructor(obj) {
        this.id = new SafeNumber(obj.id).value;
        this.doctorName = new SafeString(obj.doctorName, 0, config.doctorName_length).value;
        this.patientName = new SafeString(obj.patientName, 0, config.patientName_length).value;
        this.patientSex = new SafeString(obj.patientSex, 0, config.patientSex_length).value;
        if (!this.patientSex || [ '男', '女' ].includes(this.patientSex) == -1) {
            this.patientSex = '未知';
        }
        this.patientID = new SafeString(obj.patientID, 0, config.patientID_length).value;
        this.diagnosisNumber = new SafeString(obj.diagnosisNumber, 0, config.diagnosisNumber_length).value;
        this.hospitalizationNumber = new SafeString(obj.hospitalizationNumber, 0, config.hospitalizationNumber_length).value;
        this.remark = new SafeString(obj.remark, 0, 200).value;
    }
}

module.exports = UpdateWashRecord;